package com.dhcc.DRGsHosp.facade.impl;

import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;

import javax.inject.Named;

import org.springframework.beans.factory.annotation.Autowired;

import com.dhcc.DRGsHosp.application.QuotaManageDataApplication;
import com.dhcc.DRGsHosp.facade.QuotaManageDataFacade;
/**
 * @Discription：    测试，不允许其他功能写入
 * @Author：liuhongjun  
 * @ClassName: QuotaManageDataFacadeImpl  
 * @Date: 2018年4月26日 上午11:25:11  
 * @Version：3.1.0 DHC.DRGs
 */
@Named("QuotaManageDataFacadeImpl000000")
public class QuotaManageDataFacadeImpl implements QuotaManageDataFacade {

	@Autowired
	private  QuotaManageDataApplication  quotaManageDataApplication;
	@Override
	public void createDepDrgQuota() {	
		Map<String,Object> map =quotaManageDataApplication.createDepDrgQuota();
		List<Map<String,Object>> deplist=(List<Map<String, Object>>) map.get("deplist");
		for(Map<String,Object> dep:deplist) {
			String depcode=dep.get("depcode")+"";
			String quotaCode=dep.get("quotacode")+"";
			Double qvalue=Double.valueOf(dep.get("avalue")==null?"0":dep.get("avalue").toString());	
			List<Map<String,Object>> drglist=quotaManageDataApplication.getDrgByDepcode(depcode);
			for(Map<String,Object> drg:drglist) {
				String drgCode=drg.get("DRGCODE")+"";
				quotaManageDataApplication.insertData(depcode,drgCode,quotaCode,qvalue);
			}
		}
	}

}
